
<cfcomponent name="customerService" output="false">

	<cffunction name="init" access="public" output="false" returntype="model.customer.customerService">
		<cfargument name="transfer" type="transfer.com.Transfer" required="true" />
		<cfargument name="customerGateway" type="model.customer.customerGateway" required="true" />

		<cfset variables.transfer = arguments.transfer />
		<cfset variables.customerGateway = arguments.customerGateway />

		<cfreturn this/>
	</cffunction>

	<cffunction name="createcustomer" access="public" output="false" returntype="model.customer.customer">
		<cfargument name="cust_notes" type="string" required="false" />
		<cfargument name="cus_sysid" type="numeric" required="true" />
		<cfargument name="cus_name_first" type="string" required="false" />
		<cfargument name="cus_name_last" type="string" required="false" />
		<cfargument name="cus_full_name" type="string" required="false" />
		<cfargument name="cus_address" type="string" required="false" />
		<cfargument name="cus_city" type="string" required="false" />
		<cfargument name="cus_state" type="string" required="false" />
		<cfargument name="cus_zip_code" type="string" required="false" />
		<cfargument name="cus_zip_plus" type="string" required="false" />
		<cfargument name="cus_areacode" type="numeric" required="false" />
		<cfargument name="cus_phonenum" type="numeric" required="false" />
		<cfargument name="cus_first_contact" type="numeric" required="false" />
		<cfargument name="cus_notes_q" type="boolean" required="false" />
		
			
		<cfset var customer = variables.transfer.get("customer.customer",arguments.cus_sysid) />
		<cfset customer.setMemento(arguments) />
		<cfreturn customer />
	</cffunction>

	<cffunction name="getcustomer" access="public" output="false" returntype="any">
		<cfargument name="cus_sysid" type="numeric" required="true" />

		<cfreturn variables.transfer.get("customer.customer",arguments.cus_sysid) />
	</cffunction>

	<cffunction name="getcustomers" access="public" output="false" returntype="array">
		<cfargument name="cust_notes" type="string" required="false" />
		<cfargument name="cus_sysid" type="numeric" required="false" />
		<cfargument name="cus_name_first" type="string" required="false" />
		<cfargument name="cus_name_last" type="string" required="false" />
		<cfargument name="cus_full_name" type="string" required="false" />
		<cfargument name="cus_address" type="string" required="false" />
		<cfargument name="cus_city" type="string" required="false" />
		<cfargument name="cus_state" type="string" required="false" />
		<cfargument name="cus_zip_code" type="string" required="false" />
		<cfargument name="cus_zip_plus" type="string" required="false" />
		<cfargument name="cus_areacode" type="numeric" required="false" />
		<cfargument name="cus_phonenum" type="numeric" required="false" />
		<cfargument name="cus_first_contact" type="numeric" required="false" />
		<cfargument name="cus_notes_q" type="boolean" required="false" />
		
		<cfreturn variables.customerGateway.getByAttributes(argumentCollection=arguments) />
	</cffunction>

	<cffunction name="savecustomer" access="public" output="false" returntype="void">
		<cfargument name="customer" type="model.customer.customer" required="true" />
		
		<cfset variables.transfer.save(arguments.customer) />
	</cffunction>

	<cffunction name="deletecustomer" access="public" output="false" returntype="void">
		<cfargument name="cus_sysid" type="numeric" required="true" />
		
		<cfset var customer = variables.transfer.get("customer.customer",arguments.cus_sysid) />
		<cfset variables.transfer.delete(customer) />
	</cffunction>
</cfcomponent>
